using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class MapControlManager : MonoBehaviour
{
	public List<MapControl> mapControls = new List<MapControl>();

	public float timeRefresh;

	public GameObject showDistrict;

	public GameObject hideDistrict;

	private float time;

	private bool districtVisible = true;

	private void Awake()
	{
		if (!SceneManager.GetActiveScene().name.Equals("Level1"))
		{
			base.gameObject.SetActive(false);
			return;
		}
		foreach (MapControl mapControl in mapControls)
		{
			mapControl.master = this;
		}
		ReadSettingds();
		showDistrict.SetActive(!districtVisible);
		hideDistrict.SetActive(districtVisible);
	}

	private void OnEnable()
	{
		ManagerPVPLevels.instance.InitRoomList();
		ReadSettingds();
	}

	private void ReadSettingds()
	{
	}

	private void Update()
	{
		time += Time.unscaledDeltaTime;
		if (time > timeRefresh)
		{
			ReadSettingds();
			time = 0f;
		}
	}

	public void HideButton()
	{
		foreach (MapControl mapControl in mapControls)
		{
			mapControl.HideBattle();
		}
	}

	public void SwitchVisible()
	{
		districtVisible = !districtVisible;
		foreach (MapControl mapControl in mapControls)
		{
			mapControl.Visible = districtVisible;
		}
		showDistrict.SetActive(!districtVisible);
		hideDistrict.SetActive(districtVisible);
	}
}
